import request from '@/utils/request';
import { parseStrEmpty } from '@/utils/ruoyi';

// 查询列表
export function list(query) {
    return request({
        url: '/manage/device/devicePage',
        method: 'get',
        params: query
    });
}

// 详情
export function getById(query) {
    return request({
        url: '/manage/device/getById/' + query.id,
        method: 'get',
        params: query
    });
}

// 新增
export function add(data) {
    return request({
        url: '/manage/device/add',
        method: 'post',
        data: data
    });
}

// 修改
export function edit(data) {
    return request({
        url: '/manage/device/edit',
        method: 'put',
        data: data
    });
}

// 删除
export function deleteById(data) {
    return request({
        url: '/manage/device/deleteById/' + data.id,
        method: 'delete',
        data
    });
}

// 根据设备编号或者设备名称获取设备列表
export function getListByDeviceNameOrDeviceNum(query) {
    return request({
        url: '/manage/device/getListByDeviceNameOrDeviceNum',
        method: 'get',
        params: query
    });
}

// 获取设备列表
export function getList(query) {
    return request({
        url: '/manage/device/getList',
        method: 'get',
        params: query
    });
}

// 根据设备id获取关联实验设备数据
export function getExperimentDeviceListByDeviceId(query) {
    return request({
        url: '/manage/experimentDevices/getExperimentDeviceListByDeviceId/' + query.deviceId,
        method: 'get',
        params: query
    });
}
